/**
 * Copyright (c) 2017-present, Daniel
 * All rights reserved.
 *
 * @flow
 */

import React, {PureComponent} from 'react';
import {StyleSheet, View, Image, Text} from 'react-native';
import {StackNavigator, TabNavigator, TabBarBottom} from 'react-navigation';


import TabBaritem from '../src/widget/TabBaritem';
import Color from '../src/widget/Color';
import HomeScene from './scene/Home/HomeScene';
import NearbyScene from './scene/Nearby/NearbyScene';
import OrderScene from './scene/Order/OrderScene';
import MineScene from './scene/Mine/MineScene';
import WebScene from './scene/Web/WebScene';




class RootScene extends PureComponent<> {

    render() {
        return (
            <Navigator/>
        )
    }
}

const Tab = TabNavigator(
        {
            Home: {
                screen: HomeScene,
                navigationOptions: () => ({
                    title:'111111',
                    tabBarLabel: '团购',
                    tabBarIcon: ({focused, tintColor}) => (
                        <TabBaritem
                            normalImage={require('./img/tabbar/tabbar_homepage.png')}
                            selectedImage={require('./img/tabbar/tabbar_homepage_selected.png')}
                            focused={focused}
                            tintColor={tintColor}
                        />
                    )
                })
            },
            Nearby: {
                screen: NearbyScene,
                navigationOptions: () => ({
                    tabBarLabel: '附近',
                    tabBarIcon: ({focused, tintColor}) => (
                        <TabBaritem
                            normalImage={require('./img/tabbar/tabbar_merchant.png')}
                            selectedImage={require('./img/tabbar/tabbar_merchant_selected.png')}
                            focused={focused}
                            tintColor={tintColor}
                        />

                    )
                })
            },
            Order: {
                screen: OrderScene,
                navigationOptions: () => ({
                    tabBarLabel: '订单',
                    tabBarIcon: ({focused, tintColor}) => (
                        <TabBaritem
                            normalImage={require('./img/tabbar/tabbar_order.png')}
                            selectedImage={require('./img/tabbar/tabbar_order_selected.png')}
                            focused={focused}
                            tintColor={tintColor}
                        />

                    )
                })

            },
            Mine: {
                screen: MineScene,
                navigationOptions: () => ({
                    tabBarLabel: '我的',
                    tabBarIcon: ({focused, tintColor}) => (
                        <TabBaritem
                            normalImage={require('./img/tabbar/tabbar_mine.png')}
                            selectedImage={require('./img/tabbar/tabbar_mine_selected.png')}
                            focused={focused}
                            tintColor={tintColor}
                        />

                    )
                })

            }

        },{
            tabBarComponent:TabBarBottom,//底部组件
            tabBarPosition:'bottom',//设置TabBar，android默认在顶部，iOS在底部
            lazy:true,//是否第一次全部加载
            animationEnabled:false,//是需要动画
            swipeEnabled:false,//是否支持横向划动
            tabBarOptions:{
                activeTintColor:Color.primary,
                inactiveTintColor:Color.gray,
                style:{backgroundColor:"white"}
            }
          }
    )


const Navigator = StackNavigator({
    Tab:{screen:Tab},
    WebScene:{screen:WebScene},
},{
    navigationOptions:{
        headerTintColor:'red',
        headerBackTitle:null,
    }
    }
)


const styles = StyleSheet.create({

})

export default RootScene